cmake_minimum_required(VERSION 3.8)
project(lifecycle_cpp)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(ros2_cpp_pkg REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(lifecycle_msgs REQUIRED)

add_executable(move_robot_server src/move_robot_server.cpp)
ament_target_dependencies(move_robot_server rclcpp ros2_cpp_pkg rclcpp_lifecycle rclcpp_action)
# target_link_libraries(move_robot_server "${cpp_typesupport_target}")

add_executable(move_robot_startup src/move_robot_startup.cpp)
ament_target_dependencies(move_robot_startup rclcpp lifecycle_msgs)

# config for ROS2 cli tools
install(TARGETS
  move_robot_server
  # move_robot_client
  move_robot_startup
  DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY
  launch
  DESTINATION share/${PROJECT_NAME}
)

ament_package()
